package com.stupro.cjlu.common.utils;

import com.stupro.cjlu.common.vo.StudentItemVO;
import com.stupro.cjlu.common.vo.TeacherInsertVO;
import com.stupro.cjlu.common.vo.TeacherVO;
import com.stupro.cjlu.entity.Students;
import com.stupro.cjlu.entity.Teacher;
import org.springframework.stereotype.Component;

@Component
public class VOToEntity {
    public static Students toStudent(StudentItemVO studentVO){
        Students student = new Students();
        student.setStuID(studentVO.getStuID());
        student.setStuName(studentVO.getStuName());
        student.setStuClass(studentVO.getStuClass());
        student.setStuSex(studentVO.getStuSex());
        return student;
    }

    public static Teacher toTeacher(TeacherVO teacherVO){
        Teacher teacher = new Teacher();
        teacher.setTeaID(teacherVO.getTeaID());
        teacher.setTeaAge(teacherVO.getTeaAge());
        teacher.setTeaName(teacherVO.getTeaName());
        teacher.setTeaSex(teacherVO.getTeaSex());
        return teacher;
    }

    public static Teacher toTeacher(TeacherInsertVO teacherVO){
        Teacher teacher = new Teacher();
        teacher.setTeaID(teacherVO.getTeaID());
        teacher.setTeaPwd(teacherVO.getOldPwd());
        teacher.setTeaName(teacherVO.getTeaName());
        return teacher;
    }

}
